home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / fluidCheckResolutionAgainstC < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.7 KB  |  90 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  20 Feb 2002
  22. //
  23. //  Description:
  24. //      Make sure the fluid's resolution matches its cache
  25. //        
  26. //
  27. global proc fluidCheckResolutionAgainstCaches() {
  28.     if( !`exists getActiveFluidsShapes` ) {
  29.         source "getFluidShape.mel";
  30.     }
  31.  
  32.     string $activeFluids[] = getActiveFluidShapes();
  33.     for( $fluid in $activeFluids ) {
  34.         float $fRes[] = `getAttr ($fluid + ".resolution")`; 
  35.         int $errorCondition = 0;
  36.  
  37.         int $hasCache = `fluidCacheInfo -hasCache -ic $fluid`;
  38.         
  39.         if( $hasCache == 1 ) {
  40.             int $icRes[] = `fluidCacheInfo -ic -re $fluid`;
  41.             if( $icRes[0] != $fRes[0] 
  42.             ||  $icRes[1] != $fRes[1] 
  43.             ||  $icRes[2] != $fRes[2] )
  44.             { 
  45.                 $errorCondition += 1;
  46.             }
  47.         }
  48.         
  49.         $hasCache = `fluidCacheInfo -hasCache -pb $fluid`;
  50.         
  51.         if( $hasCache == 1 ) {
  52.             int $pbRes[] = `fluidCacheInfo -pb -re $fluid`;
  53.             if( $pbRes[0] != $fRes[0] 
  54.             ||  $pbRes[1] != $fRes[1] 
  55.             ||  $pbRes[2] != $fRes[2] ) 
  56.             { 
  57.                 $errorCondition += 2;
  58.             }
  59.         }
  60.  
  61.         string $noMatch = ( "The resolution of \'" + $fluid + "\' does not " +
  62.                             "match the resolution of its " );
  63.         
  64.         string $rebuild;
  65.         string $rebuildPB = "To rebuild the cache, use \'Create Cache\'.  ";
  66.         string $rebuildIC = ( "To rebuild the Initial State, use \'Set as " +
  67.                               "Initial State\'.  " );
  68.         string $changeRes = ( "To change a fluid's resolution, use \'Edit Fluid " +
  69.                               "Resolution\'." );
  70.         
  71.         if( $errorCondition > 2 ) {
  72.             $noMatch += "cache or Initial State.  ";
  73.             $rebuild = $rebuildPB + $rebuildIC;
  74.         } else if( $errorCondition > 1 ) {
  75.             $noMatch += "cache.  ";
  76.             $rebuild = $rebuildPB;
  77.         } else if( $errorCondition > 0 ) {
  78.             $noMatch += "Initial State.  ";
  79.             $rebuild = $rebuildIC;
  80.         }
  81.         
  82.         if( $errorCondition > 0 ) {
  83.             warning( $noMatch );
  84.             warning( $rebuild );
  85.             warning( $changeRes );
  86.         }
  87.     }
  88. }
  89.  
  90.